package com.ruoyi.ChatContentInfo.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.ChatContentInfo.domain.ChatContentInfo;
import com.ruoyi.ChatContentInfo.service.IChatContentInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * ChatContentInfoController
 * 
 * @author ruoyi
 * @date 2024-09-10
 */
@RestController
@RequestMapping("/ChatContentInfo/ChatContentInfo")
public class ChatContentInfoController extends BaseController
{
    @Autowired
    private IChatContentInfoService chatContentInfoService;

    /**
     * 查询ChatContentInfo列表
     */
    @PreAuthorize("@ss.hasPermi('ChatContentInfo:ChatContentInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(ChatContentInfo chatContentInfo)
    {
        startPage();
        List<ChatContentInfo> list = chatContentInfoService.selectChatContentInfoList(chatContentInfo);
        return getDataTable(list);
    }

    /**
     * 导出ChatContentInfo列表
     */
    @PreAuthorize("@ss.hasPermi('ChatContentInfo:ChatContentInfo:export')")
    @Log(title = "ChatContentInfo", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ChatContentInfo chatContentInfo)
    {
        List<ChatContentInfo> list = chatContentInfoService.selectChatContentInfoList(chatContentInfo);
        ExcelUtil<ChatContentInfo> util = new ExcelUtil<ChatContentInfo>(ChatContentInfo.class);
        util.exportExcel(response, list, "ChatContentInfo数据");
    }

    /**
     * 获取ChatContentInfo详细信息
     */
    @PreAuthorize("@ss.hasPermi('ChatContentInfo:ChatContentInfo:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(chatContentInfoService.selectChatContentInfoById(id));
    }

    /**
     * 新增ChatContentInfo
     */
    @PreAuthorize("@ss.hasPermi('ChatContentInfo:ChatContentInfo:add')")
    @Log(title = "ChatContentInfo", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ChatContentInfo chatContentInfo)
    {
        return toAjax(chatContentInfoService.insertChatContentInfo(chatContentInfo));
    }

    /**
     * 修改ChatContentInfo
     */
    @PreAuthorize("@ss.hasPermi('ChatContentInfo:ChatContentInfo:edit')")
    @Log(title = "ChatContentInfo", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ChatContentInfo chatContentInfo)
    {
        return toAjax(chatContentInfoService.updateChatContentInfo(chatContentInfo));
    }

    /**
     * 删除ChatContentInfo
     */
    @PreAuthorize("@ss.hasPermi('ChatContentInfo:ChatContentInfo:remove')")
    @Log(title = "ChatContentInfo", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(chatContentInfoService.deleteChatContentInfoByIds(ids));
    }
}
